﻿using System;
using System.Threading;
using System.Threading.Tasks;

namespace Sidvall.Tasks
{
	public abstract class MonitoredTaskBase : Sidvall.Tasks.IMonitoredTask
	{
		#region Public Members

		public abstract Task ExecuteAsync(IProgress<MonitoredTaskProgress> progress, CancellationToken cancellationToken);

		#region TaskId

		private string _TaskId = string.Empty;
		public string TaskId
		{
			get
			{
				return _TaskId;
			}
			protected set
			{
				value = Sidvall.Business.ValidationManager.GetValidString(value, false, null);
				_TaskId = value;
			}
		}

		#endregion

		#endregion
		#region Constructor

		protected MonitoredTaskBase()
		{
		}
		protected MonitoredTaskBase(string taskId)
		{
			this.TaskId = taskId;
		}

		#endregion
	}
}
